# -*- coding: utf-8 -*-
# copyright 2009  Nik Lutz
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
# USA

from PyQt4.QtCore import *
from PyQt4.QtGui import *
from PyKDE4.kdeui import *
from PyKDE4.kio import *
from PyKDE4.kdecore import *
from ui_filterparameters import Ui_Form

class FilterParameters(QWidget, Ui_Form):
  configuration = None
  def __init__(self, parent, configuration ):
    QWidget.__init__(self)
    self.setupUi(self)
    self.parent = parent
    self.configuration = configuration
    for config in configuration:
        self.__dict__[config].setChecked(self.parseBoolString(configuration[config]))

    
  def parseBoolString(self,boolOrString):
    if boolOrString is True or boolOrString is False:
        return boolOrString
    return boolOrString[0].upper()=="T"
    
  def getConfiguration(self):
    newConfig = {}
    for config in self.configuration:
        newConfig[config] = str(self.__dict__[config].isChecked())
    return newConfig
    





